package com.rabbitmq.receivers;

import com.rabbitmq.config.DirectConfig;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * 路由模式：消息只去到它绑定的 routingKey 队列中去
 *
 * @author 王霄
 * @date 2022/1/8 16:46
 */
@Component
public class DirectReceiver {

    @RabbitListener(queues = DirectConfig.QUEUE1)
    public void consume1(String message) {
        System.out.println("Direct模式接收队列one消息 : " + message);
    }

    @RabbitListener(queues = DirectConfig.QUEUE2)
    public void consume2(String message) {
        System.out.println("Direct模式接收队列two消息 : " + message);
    }
}
